package com.xyy.saas.payment.cores.enums;

import java.util.Arrays;
import java.util.Map;
import java.util.function.UnaryOperator;
import java.util.stream.Collectors;

public enum  RiskControlBusinessTypeEnum {
    PAYER((byte)0,"付款人"),
    MERCHANT((byte)1, "商户");

    private byte type;
    private String desc;

    RiskControlBusinessTypeEnum(byte type, String desc) {
        this.type = type;
        this.desc = desc;
    }
    private static Map<Byte, RiskControlBusinessTypeEnum> code2Enum;

    static {
        code2Enum = Arrays.asList(values()).stream().collect(Collectors.toMap(RiskControlBusinessTypeEnum::getType, UnaryOperator.identity()));
    }

    public static RiskControlBusinessTypeEnum getEnum(Byte type){
        return code2Enum.get(type);
    }


    public byte getType() {
        return type;
    }

    public void setType(byte type) {
        this.type = type;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}